<?xml version='1.0' encoding='UTF-8' ?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                xmlns:h="http://java.sun.com/jsf/html"
                template="/WEB-INF/templates/default.xhtml">

    <ui:define name="content">
        <h:dataTable class="table table-striped table-bordered" value="#{deliveries}" var="delivery" rendered="#{not empty deliveries}">
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['delivery.deliveryNumber']}"/></f:facet>
                <h:outputText value="#{delivery.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['delivery.recipientName']}"/></f:facet>
                <h:outputText value="#{delivery.recipientName}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['delivery.recipientAddress']}"/></f:facet>
                <h:outputText value="#{delivery.recipientAddress} #{delivery.recipientCity} #{delivery.recipientZip}"/>
            </h:column>
            <h:column>
                <f:facet name="header"><h:outputText value="#{msg['actions']}"/></f:facet>
                <h:button class="btn" outcome="/pages/user/markAsDelivered" value="#{msg['form.markAsDelivered']}" rendered="#{delivery.deliveryDate == null}">
                    <f:param name="id" value="#{delivery.id}" />
                </h:button>
            </h:column>
        </h:dataTable>
    </ui:define>
</ui:composition>

